{ "cells": [ { "cell_type": "markdown", "id": "c85f17de", "metadata": {}, "source": [ "# LMP Data Examples\n", "\n", "## Walkthrough on how to query LMP data from SPP using gridstatus" ] }, { "cell_type": "code", "execution_count": 1, "id": "d0ad47ce", "metadata": {}, "outputs": [], "source": [ "import gridstatus\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "55d3f5c9", "metadata": {}, "outputs": [], "source": [ "iso = gridstatus.SPP()" ] }, { "cell_type": "markdown", "id": "5f2f68dc", "metadata": {}, "source": [ "## Available Markets\n", "\n", "SPP has 2 LMP Markets you can query:" ] }, { "cell_type": "code", "execution_count": 3, "id": "0df4d382", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[,\n", " ]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "iso.markets" ] }, { "cell_type": "markdown", "id": "2f75e652", "metadata": {}, "source": [ "## Available Location Types\n", "\n", "The following locations types are available:" ] }, { "cell_type": "code", "execution_count": 4, "id": "ef342e68", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "['HUB', 'INTERFACE', 'SETTLEMENT_LOCATION']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "iso.location_types" ] }, { "cell_type": "markdown", "id": "fbab8f4d", "metadata": {}, "source": [ "`HUB` and `INTERFACE` will filter for those location types, but when choosing `SETTLEMENT_LOCATION`, all available locations and location types will be returned and labeled correctly." ] }, { "cell_type": "markdown", "id": "a2fe9dbd", "metadata": {}, "source": [ "## Query Latest Real-Time LMPs by Hub\n", "\n", "By default, the LMP methods will get data for the Hub nodes in SPP:" ] }, { "cell_type": "code", "execution_count": 5, "id": "844c1531", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-27 22:20:00-06:00REAL_TIME_5_MINSPPNORTH_HUBHub-32.815515.8662-47.8942-0.7875
12022-12-27 22:20:00-06:00REAL_TIME_5_MINSPPSOUTH_HUBHub16.960915.86611.4744-0.3796
\n", "
" ], "text/plain": [ " Time Market Location Location Type \\\n", "0 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN SPPNORTH_HUB Hub \n", "1 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN SPPSOUTH_HUB Hub \n", "\n", " LMP Energy Congestion Loss \n", "0 -32.8155 15.8662 -47.8942 -0.7875 \n", "1 16.9609 15.8661 1.4744 -0.3796 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(date=\"latest\", market=\"REAL_TIME_5_MIN\")\n", "df" ] }, { "cell_type": "markdown", "id": "4526f973", "metadata": {}, "source": [ "## Query Latest Real-Time LMPs by Settlement Location" ] }, { "cell_type": "code", "execution_count": 6, "id": "83b67ed8", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-27 22:20:00-06:00REAL_TIME_5_MINAECSettlement Location69.467015.866153.03360.5673
12022-12-27 22:20:00-06:00REAL_TIME_5_MINAECC_CSWSSettlement Location82.984015.866266.23790.8799
22022-12-27 22:20:00-06:00REAL_TIME_5_MINAECC_ELKINSSettlement Location109.730615.866192.95100.9135
32022-12-27 22:20:00-06:00REAL_TIME_5_MINAECC_FITZHUGHSettlement Location78.646215.866161.58571.1944
42022-12-27 22:20:00-06:00REAL_TIME_5_MINAECC_FLTCREEKSettlement Location124.958415.8662108.54840.5438
\n", "
" ], "text/plain": [ " Time Market Location \\\n", "0 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AEC \n", "1 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AECC_CSWS \n", "2 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AECC_ELKINS \n", "3 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AECC_FITZHUGH \n", "4 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AECC_FLTCREEK \n", "\n", " Location Type LMP Energy Congestion Loss \n", "0 Settlement Location 69.4670 15.8661 53.0336 0.5673 \n", "1 Settlement Location 82.9840 15.8662 66.2379 0.8799 \n", "2 Settlement Location 109.7306 15.8661 92.9510 0.9135 \n", "3 Settlement Location 78.6462 15.8661 61.5857 1.1944 \n", "4 Settlement Location 124.9584 15.8662 108.5484 0.5438 " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(\n", " date=\"latest\", market=\"REAL_TIME_5_MIN\", location_type=\"SETTLEMENT_LOCATION\"\n", ")\n", "df.head(5)" ] }, { "cell_type": "markdown", "id": "6c421d7b", "metadata": {}, "source": [ "When requesting Settlement Locations, locations which are Interfaces and Hubs are marked as such." ] }, { "cell_type": "code", "execution_count": 7, "id": "27f872ef", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/plain": [ "['Settlement Location', 'Interface', 'Hub']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[\"Location Type\"].unique().tolist()" ] }, { "cell_type": "markdown", "id": "f487dbbe", "metadata": {}, "source": [ "## Query Latest Real-Time LMPs by Interface\n" ] }, { "cell_type": "code", "execution_count": 8, "id": "08b59bfa", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-27 22:20:00-06:00REAL_TIME_5_MINAECIInterface79.502715.866163.14880.4878
12022-12-27 22:20:00-06:00REAL_TIME_5_MINALTWInterface43.742915.866227.68670.1900
22022-12-27 22:20:00-06:00REAL_TIME_5_MINAMRNInterface43.742915.866227.68670.1900
32022-12-27 22:20:00-06:00REAL_TIME_5_MINBLKWInterface-23.288215.8661-38.5089-0.6454
42022-12-27 22:20:00-06:00REAL_TIME_5_MINCLECInterface43.742915.866227.68670.1900
\n", "
" ], "text/plain": [ " Time Market Location Location Type LMP \\\n", "0 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AECI Interface 79.5027 \n", "1 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN ALTW Interface 43.7429 \n", "2 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN AMRN Interface 43.7429 \n", "3 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN BLKW Interface -23.2882 \n", "4 2022-12-27 22:20:00-06:00 REAL_TIME_5_MIN CLEC Interface 43.7429 \n", "\n", " Energy Congestion Loss \n", "0 15.8661 63.1488 0.4878 \n", "1 15.8662 27.6867 0.1900 \n", "2 15.8662 27.6867 0.1900 \n", "3 15.8661 -38.5089 -0.6454 \n", "4 15.8662 27.6867 0.1900 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(date=\"latest\", market=\"REAL_TIME_5_MIN\", location_type=\"Interface\")\n", "df.head(5)" ] }, { "cell_type": "markdown", "id": "bfa67c9c", "metadata": {}, "source": [ "## Query Today's Real-Time LMPs by Interface\n" ] }, { "cell_type": "code", "execution_count": 9, "id": "c8477608", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-27 00:00:00-06:00REAL_TIME_5_MINAECIInterface62.345718.160843.57270.6122
12022-12-27 00:00:00-06:00REAL_TIME_5_MINALTWInterface50.611318.160932.41840.0320
22022-12-27 00:00:00-06:00REAL_TIME_5_MINAMRNInterface50.611318.160932.41840.0320
32022-12-27 00:00:00-06:00REAL_TIME_5_MINBLKWInterface-25.393418.1608-42.6874-0.8668
42022-12-27 00:00:00-06:00REAL_TIME_5_MINCLECInterface50.611318.160932.41840.0320
\n", "
" ], "text/plain": [ " Time Market Location Location Type LMP \\\n", "0 2022-12-27 00:00:00-06:00 REAL_TIME_5_MIN AECI Interface 62.3457 \n", "1 2022-12-27 00:00:00-06:00 REAL_TIME_5_MIN ALTW Interface 50.6113 \n", "2 2022-12-27 00:00:00-06:00 REAL_TIME_5_MIN AMRN Interface 50.6113 \n", "3 2022-12-27 00:00:00-06:00 REAL_TIME_5_MIN BLKW Interface -25.3934 \n", "4 2022-12-27 00:00:00-06:00 REAL_TIME_5_MIN CLEC Interface 50.6113 \n", "\n", " Energy Congestion Loss \n", "0 18.1608 43.5727 0.6122 \n", "1 18.1609 32.4184 0.0320 \n", "2 18.1609 32.4184 0.0320 \n", "3 18.1608 -42.6874 -0.8668 \n", "4 18.1609 32.4184 0.0320 " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(date=\"today\", market=\"REAL_TIME_5_MIN\", location_type=\"Interface\")\n", "df.head(5)" ] }, { "cell_type": "markdown", "id": "3b3c1f2c", "metadata": {}, "source": [ "## Query Day-Ahead LMPs by Hub\n", "\n", "Return today's day-ahead hourly data by hub:" ] }, { "cell_type": "code", "execution_count": 10, "id": "fbb7d738", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYSPPNORTH_HUBHub-2.065018.3069-19.4408-0.9311
12022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYSPPSOUTH_HUBHub29.245218.306911.1502-0.2119
22022-12-28 01:55:00-06:00DAY_AHEAD_HOURLYSPPNORTH_HUBHub-4.312917.8149-21.2129-0.9149
32022-12-28 01:55:00-06:00DAY_AHEAD_HOURLYSPPSOUTH_HUBHub28.688117.815011.0831-0.2100
42022-12-28 02:55:00-06:00DAY_AHEAD_HOURLYSPPNORTH_HUBHub-4.656416.6584-20.4966-0.8182
\n", "
" ], "text/plain": [ " Time Market Location Location Type \\\n", "0 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY SPPNORTH_HUB Hub \n", "1 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY SPPSOUTH_HUB Hub \n", "2 2022-12-28 01:55:00-06:00 DAY_AHEAD_HOURLY SPPNORTH_HUB Hub \n", "3 2022-12-28 01:55:00-06:00 DAY_AHEAD_HOURLY SPPSOUTH_HUB Hub \n", "4 2022-12-28 02:55:00-06:00 DAY_AHEAD_HOURLY SPPNORTH_HUB Hub \n", "\n", " LMP Energy Congestion Loss \n", "0 -2.0650 18.3069 -19.4408 -0.9311 \n", "1 29.2452 18.3069 11.1502 -0.2119 \n", "2 -4.3129 17.8149 -21.2129 -0.9149 \n", "3 28.6881 17.8150 11.0831 -0.2100 \n", "4 -4.6564 16.6584 -20.4966 -0.8182 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(date=\"today\", market=\"DAY_AHEAD_HOURLY\", location_type=\"Hub\")\n", "df.head(5)" ] }, { "cell_type": "markdown", "id": "dc1a6143", "metadata": {}, "source": [ "## Query Day-Ahead LMPs by Interface\n", "\n", "Return the latest day-ahead hourly data by interface:" ] }, { "cell_type": "code", "execution_count": 11, "id": "5cae794b", "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
TimeMarketLocationLocation TypeLMPEnergyCongestionLoss
02022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYAECIInterface68.339118.306949.39850.6337
12022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYALTWInterface56.841518.307038.09570.4388
22022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYAMRNInterface56.841518.307038.09570.4388
32022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYBLKWInterface-12.277518.3069-29.8699-0.7145
42022-12-28 00:55:00-06:00DAY_AHEAD_HOURLYCLECInterface56.841518.307038.09570.4388
\n", "
" ], "text/plain": [ " Time Market Location Location Type LMP \\\n", "0 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY AECI Interface 68.3391 \n", "1 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY ALTW Interface 56.8415 \n", "2 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY AMRN Interface 56.8415 \n", "3 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY BLKW Interface -12.2775 \n", "4 2022-12-28 00:55:00-06:00 DAY_AHEAD_HOURLY CLEC Interface 56.8415 \n", "\n", " Energy Congestion Loss \n", "0 18.3069 49.3985 0.6337 \n", "1 18.3070 38.0957 0.4388 \n", "2 18.3070 38.0957 0.4388 \n", "3 18.3069 -29.8699 -0.7145 \n", "4 18.3070 38.0957 0.4388 " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = iso.get_lmp(date=\"today\", market=\"DAY_AHEAD_HOURLY\", location_type=\"Interface\")\n", "df.head(5)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" }, "vscode": { "interpreter": { "hash": "49f14642123d0cc1afa9fa45716ed5f1e915189c28b01efe02a8b7ec3c0a3fce" } } }, "nbformat": 4, "nbformat_minor": 5 }